DataMaster is a set of two XCMDs : FileToRes and ResToFile. These two externals allow to create any type of document, empty or already filled, from within a script and reopen it with the original application.
FileToRes 1.3
SYNTAX
FileToRes <file path or name>,<DATA res name>[,<dest file>]
PARAMETERS
<file path or name> can be a single name or whole pathname. If just a single name is supplied, the file will be searched in the same folder as the current stack.
<DATA res name> is the name of the DATA resource to create.
<dest file> is the destination file pathname where the DATA resource will be created. If omited, current stack is used.
Using "!", "?" and "=" as first parameter will return an online help (resp. copyright, syntax and output).
USING
The XCMD can generate DATA resource from any kind of file with no resource fork. Along with the datas, the file type, creator and flags are put in the DATA resource in order for ResToFile XCMD to regenerate exactly the same file than the original.
If a DATA resource already exists with the same name, a dialog will be prompted for the user to choose to rename, replace or cancel. If rename is choosen, a second dialog will ask for the new name, and the Result will return the changed name. With replace, the previous resource will be overwritten.
If you plan to capture a stack, compact it before in order to get the smallest resource as possible.
ERRORS
If an error occurs, the Result can return :
"Error : Not a file"
"Error : Not a folder"
"Error : Alias file not supported"
"Error : Volume not found"
"Error : Bad Name"
"Error : File not found"
"Error : Folder not found"
"Error : File is busy"
"Error : I/O Error"
"Error : Folder is full"
"Error : Volume is locked"
"Error : No resource fork"
"Error : Duplicate file/folder name"
"Error : Moving whole volume not allowed"
"Error : Not an AppleShare volume"
"Error : AppleShare insufficient privileges"
"Error : Missing or empty parameter(s)"
"Error : Creation aborted"
"Error : Old DATA res could't be removed"
"Error : Couldn't clear DATA resource"
"Error : Creation aborted"
"Error : This file has a resource fork"
"Error : Out of memory"
"Error : Couldn't build resource"
"Error : Couldn't create DATA resource"
HISTORY
1.3 09/22/93
• Fixed resource fork update when DATA added to current stack
• Added dest file parameter
1.2 12/25/91
• Fixed alias file bug under System 7.0.1
1.1 08/04/91
• Added support for System 7.0 alias files
• General enhancement of the code
• Added "=" param for online help
ResToFile 1.3
SYNTAX
ResToFile <name or pathName>,<DATA res name>[,<prov file>]
PARAMETERS
<file path or name> can be a single name or whole pathname. If just a single name is supplied, the file is assumed to be in the same folder than the current stack.
<DATA res name> is the name of the DATA resource which will be used to re-create the original file.
<prov file> is the provenance file pathname where the DATA resource will be loaded from. If omited, current stack is used.
Using "!", "?" and "=" as first parameter will return an online help (resp. copyright, syntax and output).
USING
The XCMD uses DATA resource previously created by FileToRes XCMD to rebuild the whole file. Since file type, creator and flags were preserved, the rebuilt file is exactly the same than the original.
If a file already exists with the same name, a dialog will be prompted for the user to choose to rename, replace or cancel. If rename is choosen, a second dialog will ask for the new name, and the Result will return the changed name. With replace, the previous file will be overwritten.
ERRORS
If an error occurs, the Result can return :
"Error : Not a file"
"Error : Not a folder"
"Error : Alias file not supported"
"Error : Volume not found"
"Error : Bad Name"
"Error : File not found"
"Error : Folder not found"
"Error : File is busy"
"Error : I/O Error"
"Error : Folder is full"
"Error : Volume is locked"
"Error : No resource fork"
"Error : Duplicate file/folder name"
"Error : Moving whole volume not allowed"
"Error : Not an AppleShare volume"
"Error : AppleShare insufficient privileges"
"Error : Missing or empty parameter(s)"
"Error : DATA resource not found"
"Error : No more disk space"
"Error : Creation aborted"
HISTORY
1.3 09/22/93
• Added prov file parameter
1.2 12/25/91
• Fixed alias file bug under System 7.0.1
1.1 08/04/91
• Added support for System 7.0 alias files
• General enhancement of the code
• Added "=" param for online help
TESTING
To test these XCMDs, just click on buttons below. A DATA resource named "TestStack" is already in the stack for testing purpose. It will create a stack template with two cards, script and objects.
Free for non-commercial use. Use in commercial software subjected to prior acknowledgement and licensing from the author, reachable at the following network addresses: